package com.yuanfengPlus.customerExpense.controller;

import com.yuanfengPlus.customerExpense.model.CustomerExpenseInfo;
import com.yuanfengPlus.customerExpense.service.impl.CustomerExpenseServiceImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@CrossOrigin
@RestController
@Slf4j
@RequestMapping("/customerExpense")
@Api(tags = "客户费用")
public class CustomerExpenseController {
    @Resource
    private CustomerExpenseServiceImpl cesi;
    @PostMapping("/select")
    @ApiOperation(value = "客户费用查询")
    public Result<PageResult> select(@RequestBody Map<String,Object> params){
        return Result.success(cesi.select(params));
    }
    @PostMapping("/insert")
    @ApiOperation(value = "添加客户费用")
    public Result<String> insert(@RequestBody CustomerExpenseInfo customerExpenseInfo){
        return cesi.insert(customerExpenseInfo);
    }
    @PostMapping("/update")
    @ApiOperation(value = "修改客户费用")
    public Result<String> update(@RequestBody CustomerExpenseInfo customerExpenseInfo){
        return cesi.update(customerExpenseInfo);
    }
    @PostMapping("/selectById")
    @ApiOperation(value = "根据id查询客户费用")
    public Result<CustomerExpenseInfo> selectById(String customer_expenses_ID){
        return cesi.selectById(customer_expenses_ID);
    }
}
